<template>
  <div id="app">
    <div class="box-header with-border">
      <h3 class="box-title">任务列表</h3>
    </div>

    <div class="box-body">
      <!-- 数据表格 -->
      <div class="table-box">
        <div class="form-group form-inline">
          <div class="btn-group">
            <button
              type="button"
              class="btn btn-default"
              title="新建"
              data-toggle="modal"
              data-target="#editModal"
            >
              <i class="fa fa-file-o"></i> 新建
            </button>
          </div>
        </div>
        <div class="box-tools pull-right">
          <div class="has-feedback"></div>
        </div>

        <!-- 展示s -->
        <!-- <div>
      <el-table
        :data="tasklist"
        style="width: 150%; margin: 0 auto"
        align="right"
      >
        <el-table-column
          prop="flowUserName"
          label="名字"
          width="140"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="task_start_time"
          label="开始时间"
          width="220"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="flowType"
          label="申请类型"
          width="220"
          align="center"
        >
        </el-table-column>
        <el-table-column label="操作" align="center">
          <template slot-scope="scope">
            <el-button
              size="mini"
              icon="el-icon-edit"
              @click="doTask(scope.$index, scope.row)"
              >同意</el-button
            >
          </template>
        </el-table-column>
      </el-table>
    </div> -->
      </div>
    </div>
    <!--  -->
    <div>
      <table>
        <thead>
          <tr>
            <th class="sorting_asc">名字</th>
            <th class="sorting_asc">开始时间</th>
            <th class="sorting_asc">申请类型</th>
             <th class="sorting_asc">任务id</th>
          </tr>
        </thead>
        <tbody>
          <tr v-for="task in tasklist" :key="task.aid">
            <td>{{ task.flowUserName }}</td>
            <td>{{ task.task_start_time }}</td>
            <td>{{ task.flowType }}</td>
            <td>{{ task.taskid }}</td>
            <td>
              <button type="button" @click="doTask(task.taskid,task.id)">同意</button>
            </td>
          </tr>
        </tbody>
      </table>
    </div>
  </div>
</template>

<script>
export default {
  name: "VseSupplyChainEnterprisecredit",

  data() {
    return {
      tasklist: [],
    };
  },
  created: function () {
    //调用方法
    this.findAll();
  },

  mounted() {},

  methods: {
    findAll: function () {
      this.$axios
        .get("http://localhost:8800/flow/findTaskInfo")
        .then((result) => {
          console.log(result);
          this.tasklist = result.data;
        });
    },
    doTask: function (taskId,id) {
      this.$axios
        .put("http://localhost:8800/flow/completeTask/" + taskId+"/"+id)
        .then((result) => {
          console.log(result);
          this.tasklist = result.data;
        });
    },
  },
};
</script>

<style lang="scss" scoped>
</style>